<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件
function order_create($length = 32, $char = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
    if(!is_int($length) || $length < 0) {
        return false;
    }
    $string = '';
    for($i = $length; $i > 0; $i--) {
        $string .= $char[mt_rand(0, strlen($char) - 1)];
    }
    return $string;
}
//过滤特殊字符
function replace_specialChar($strParam){
    $regex = "/\/|\～|\，|\。|\！|\？|\“|\”|\【|\】|\『|\』|\：|\；|\《|\》|\’|\‘|\ |\·|\~|\!|\@|\#|\\$|\%|\^|\&|\*|\(|\)|\_|\+|\{|\}|\:|\<|\>|\?|\[|\]|\,|\.|\/|\;|\'|\`|\-|\=|\\\|\|/";
    return preg_replace($regex,"",$strParam);
}
function alipay_data($appid,$url){
       $data=[
           //应用ID,您的APPID。
           'app_id' => $appid,
           //商户私钥，您的原始格式RSA私钥
           'merchant_private_key' => "MIIEpAIBAAKCAQEA8D7PBn7ziT5U1rTEl3h2m/4OhhuTnyud4qDOI60412Pm1WW8gbzyPPT1lUiawpscNOHJlN805gW7GJOeiPDOTEIH5vf1SPew2eThCGDxqDxbwC0Yw4ODRD3vAyf4HYVnA4TE/+bGIx7w7KTVEDx26mPqaQf1p9pafnEnvkYUWKJlb8cVIzVxkDeQOmw4ns588+PTmAZLRtZNyN+GffpwOJX/vAaghX1YsfSHiVPGE1DMoOp3KjeypTJNPfc6S8etJF275YdWoQVc18Y+8I/BZ7qlGlK/S5ntOikmPZlxuW5S/Z7fkw7O2VE5toVfhFQh6nnW7DzW/X3w/LWlgpQrrQIDAQABAoIBAH+IeBH0tod2pUbM80eNVTl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KfBueOe4nh3+o5mQeLDm4fPRyLkgJX85XOpOadnGI7qdGZPbU2T3CjsZxGhWbjmn3b6qIlrVlfbDwsBf/ObMKn1zlBLRitXrLj9Wp0HP4xnRo92SKzG3p+Mh8R+wtA==",
           //异步通知地址
           'notify_url' => $url,
           //同步跳转
           'return_url' => $url,
           //编码格式
           'charset' => "UTF-8",
           //签名方式
           'sign_type' => "RSA2",
           //支付宝网关
           'gatewayUrl' => "https://openapi.alipay.com/gateway.do",
           //支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
           'alipay_public_key' => "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8D7PBn7ziT5U1rTEl3h2m/4OhhuTnyud4qDOI60412Pm1WW8gbzyPPT1lUiawpscNOHJlN805gW7GJOeiPDOTEIH5vf1SPew2eThCGDxqDxbwC0Yw4ODRD3vAyf4HYVnA4TE/+bGIx7w7KTVEDx26mPqaQf1p9pafnEnvkYUWKJlb8cVIzVxkDeQOmw4ns588+PTmAZLRtZNyN+GffpwOJX/vAaghX1YsfSHiVPGE1DMoOp3KjeypTJNPfc6S8etJF275YdWoQVc18Y+8I/BZ7qlGlK/S5ntOikmPZlxuW5S/Z7fkw7O2VE5toVfhFQh6nnW7DzW/X3w/LWlgpQrrQIDAQAB",
       ];
       return $data;
}